from django.conf.urls import url, include
from django.contrib import admin
from web.views import account, home, project, manage, wiki, file, setting, dashboard, issues

urlpatterns = [
    # url(r'^test/', account.test),
    url(r'^register/$', account.register, name='register'),
    url(r'^send/sms/$', account.send_sms, name='send_sms'),
    url(r'^sms/login/$', account.sms_login, name='login_sms'),
    url(r'^login/$', account.login, name='login'),
    url(r'^logout/$', account.logout, name='logout'),
    url(r'^image/code/$', account.image_code, name='image_code'),
    url(r'^index/$', home.index, name='index'),

    # 项目列表
    url(r'^project/list/$', project.project_list, name='project_list'),
    url(r'^project/add/star/(?P<project_type>\w+)/(?P<project_id>\d+)/$', project.add_star, name='add_star'),
    url(r'^project/remove/star/(?P<project_type>\w+)/(?P<project_id>\d+)/$', project.remove_star, name='remove_star'),

    # 项目管理
    url(r'^manage/(?P<project_id>\d+)/', include([
        # 项目概览
        url(r'dashboard/$', dashboard.dashboard, name='dashboard'),
        # wiki
        url(r'wiki/$', wiki.wiki, name='wiki'),
        url(r'wiki/add/$', wiki.wiki_add, name='wiki_add'),
        url(r'wiki/delete/(?P<wiki_id>\d+)/$', wiki.wiki_delete, name='wiki_delete'),
        url(r'wiki/edit/(?P<wiki_id>\d+)/$', wiki.wiki_edit, name='wiki_edit'),
        url(r'wiki/catelog/$', wiki.wiki_catelog, name='wiki_catelog'),
        url(r'wiki/upload/$', wiki.wiki_upload, name='wiki_upload'),
        # 文件
        url(r'^file/$', file.file, name='file'),
        url(r'^file/delete/$', file.file_delete, name='file_delete'),
        url(r'^file/post/$', file.file_post, name='file_post'),
        url(r'^file/download/(?P<file_id>\d+)/$', file.file_download, name='file_download'),
        # 提供临时密钥给JS JDK
        url(r'^cos/credential/$', file.cos_credential, name='cos_credential'),

        url(r'statistic/$', manage.statistic, name='statistic'),

        # 工单任务管理
        url(r'issues/$', issues.issues, name='issues'),
        url(r'issues/myself/$', issues.issues_myself, name='issues_myself'),
        url(r'issues/all/$', issues.issues_all, name='issues_all'),
        url(r'issues/detail/(?P<order_id>\d+)/$', issues.issues_detail, name='issues_detail'),

        #

        # 系统配置信息
        url(r'setting/$', setting.setting, name='setting'),
        url(r'setting/delete/$', setting.project_delete, name='project_delete'),
    ]
        , None, None
    )),

]
